import PyPDF2

PdfFileWriter = PyPDF2.PdfFileWriter
PdfFileReader = PyPDF2.PdfFileReader
Page = PyPDF2.pdf.PageObject

f = open('凭证.pdf', 'rb')

reader = PdfFileReader(f)

page0: Page = reader.getPage(0)
width = page0.mediaBox.getWidth()
height = page0.mediaBox.getHeight()

print(width)
print(height)

writer = PdfFileWriter()
writer.addBlankPage(width, height)
newPage: Page = writer.getPage(0)

# 下移
newPage.mergeTranslatedPage(page0, 0, 0)

out = open("out/1.pdf", 'wb')
writer.write(out)
